package com.drinks.yiniang.ui.activity.user.order;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.drinks.yiniang.R;
import com.drinks.yiniang.ui.widget.dialog.ContactServiceDialog;
import com.hansen.library.Constants;
import com.hansen.library.ui.widget.image.RatioRoundImageView;
import com.hansen.library.ui.activity.BaseTranBarActivity;
import com.hansen.library.listener.OnNavgationBarClickListener;
import com.hansen.library.ui.widget.nav.NavigationBarLayout;

/**
 * 退换货页面
 *
 * @author han
 * @date 2019/09/06
 */
public class OrderReturnActivity extends BaseTranBarActivity implements OnNavgationBarClickListener {

    //nav bar
    private NavigationBarLayout nav_bar_order_return;
    //商品封面
    private RatioRoundImageView iv_order_goods_cover;
    //商品名称
    private TextView tv_order_goods_name;
    //价格
    private TextView tv_order_goods_price;
    //推荐语
    private TextView tv_order_goods_slogan;
    //商品属性
    private TextView tv_order_goods_attrs;
    //商品数量
    private TextView tv_order_goods_num;
    //退款
    private TextView tv_order_refund;
    //退货
    private TextView tv_order_return_goods;

    //提交
    private Button btn_order_return_submit;

    @Override
    protected void initView() {
        nav_bar_order_return = findViewById(R.id.nav_bar_order_return);

        iv_order_goods_cover = findViewById(R.id.iv_order_goods_cover);

        tv_order_goods_name = findViewById(R.id.tv_order_goods_name);
        tv_order_goods_price = findViewById(R.id.tv_order_goods_price);
        tv_order_goods_slogan = findViewById(R.id.tv_order_goods_slogan);
        tv_order_goods_attrs = findViewById(R.id.tv_order_goods_attrs);
        tv_order_goods_num = findViewById(R.id.tv_order_goods_num);
        tv_order_refund = findViewById(R.id.tv_order_refund);
        tv_order_return_goods = findViewById(R.id.tv_order_return_goods);

        btn_order_return_submit = findViewById(R.id.btn_order_return_submit);
    }

    @Override
    protected void initData(Bundle savedInstanceState) {
        mContext = this;
    }

    @Override
    protected void initListener() {
        nav_bar_order_return.setOnNavgationBarClickListener(this);
        tv_order_refund.setOnClickListener(this);
        tv_order_return_goods.setOnClickListener(this);
        btn_order_return_submit.setOnClickListener(this);
    }

    @Override
    public void widgetClick(View v) {
        switch (v.getId()) {
            case R.id.tv_order_refund://退款

                break;
            case R.id.tv_order_return_goods://退货

                break;
            case R.id.btn_order_return_submit://提交
                startActivity(new Intent(mContext, RefundSubmitActivity.class));
                break;
            default:
                break;
        }
    }

    @Override
    public int getTranBarResID() {
        return R.layout.activity_order_return;
    }

    @Override
    public void onBackClick(View v) {
        finish();
    }

    @Override
    public void onEditClick(View v) {
        ContactServiceDialog dialog = ContactServiceDialog.newInstance();

        dialog.show(getSupportFragmentManager(), Constants.TAG_CONTACT_SERVICE_DIALOG);
    }
}
